Update headerbar title from window title
authorMatthias Clasen <mclasen@redhat.com>
Wed, 11 Dec 2013 01:45:42 +0000 (20:45 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 11 Dec 2013 01:45:42 +0000 (20:45 -0500)
This removes a possible source of confusion in our API.
The title is now synchronized both ways between the window
and the headerbar.

https://bugzilla.gnome.org/show_bug.cgi?id=720067

gtk/gtkwindow.c

index d9490004e6cd58ff86cc3f51f03f060dde433fce..398f1ecb4ddeae1a040586fd36f770e4f687860a 100644 (file)
@@ -1796,8 +1796,13 @@ gtk_window_set_title_internal (GtkWindow   *window,
   if (gtk_widget_get_realized (widget))
     gdk_window_set_title (gtk_widget_get_window (widget), new_title);
 
-  if (priv->titlebar != NULL && update_titlebar)
-    gtk_header_bar_set_title (GTK_HEADER_BAR (priv->titlebar), new_title);
+  if (update_titlebar)
+    {
+      if (GTK_IS_HEADER_BAR (priv->titlebar))
+        gtk_header_bar_set_title (GTK_HEADER_BAR (priv->titlebar), new_title);
+      else if (GTK_IS_HEADER_BAR (priv->title_box))
+        gtk_header_bar_set_title (GTK_HEADER_BAR (priv->title_box), new_title);
+    }
 
   g_object_notify (G_OBJECT (window), "title");
 }